package com.jams.goodox.entity;

import android.text.TextUtils;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * 订单详情实体
 * Created by guozhen.hou on 2017/7/11.
 */

public class ServeOrderDetailBean<T> implements Serializable{
    private String orderStatus;//订单状态
    private String orderNumber;//订单编号
    private String emptyPayTime;//订单剩余付款时间
    private String submitOrderTime;//下单时间

    private boolean isPersonOrder;//是否是个人订单
    private CompanyAddressBean companyAddressBean;//公司地址实体
    private PersonAddressBean personAddressBean;//个人地址实体

    private T serveDetail;//根据服务订单，获得具体实体

    private double totalMoney;//应付金额
    private double realMoney;//实付金额
    private String payType;//支付方式：数值
    private double redPacketMoney;//红包抵扣金额

    private String invoiceType;//发票类型
    private String invoiceHead;//发票抬头

    private String orderId;//订单id
    private String servicePhone;//客服电话

    private String isPay;

    private ArrayList<Integer> choosePayTypeList;

    public static final String Order_Status_Need_Pay="1";//待付款
    public static final String Order_Status_Complete="2";//已完成
    public static final String Order_Status_Close="3";//已关闭

    public String getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(String orderStatus) {
        this.orderStatus = orderStatus;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public String getEmptyPayTime() {
        return (TextUtils.isEmpty(emptyPayTime)||!Order_Status_Need_Pay.equalsIgnoreCase(orderStatus))?"":String.format("剩余: %s分钟",emptyPayTime);
    }

    public void setEmptyPayTime(String emptyPayTime) {
        this.emptyPayTime = emptyPayTime;
    }

    public String getSubmitOrderTime() {
        return submitOrderTime;
    }

    public void setSubmitOrderTime(String submitOrderTime) {
        this.submitOrderTime = submitOrderTime;
    }

    public boolean isPersonOrder() {
        return isPersonOrder;
    }

    public void setPersonOrder(boolean personOrder) {
        isPersonOrder = personOrder;
    }

    public CompanyAddressBean getCompanyAddressBean() {
        return companyAddressBean==null?new CompanyAddressBean():companyAddressBean;
    }

    public void setCompanyAddressBean(CompanyAddressBean companyAddressBean) {
        this.companyAddressBean = companyAddressBean;
    }

    public PersonAddressBean getPersonAddressBean() {
        return personAddressBean==null?new PersonAddressBean():personAddressBean;
    }

    public void setPersonAddressBean(PersonAddressBean personAddressBean) {
        this.personAddressBean = personAddressBean;
    }

    public T getServeDetail() {
        return serveDetail;
    }

    public void setServeDetail(T serveDetail) {
        this.serveDetail = serveDetail;
    }

    public double getTotalMoney() {
        return totalMoney;
    }

    public void setTotalMoney(double totalMoney) {
        this.totalMoney = totalMoney;
    }

    public double getRealMoney() {
        return realMoney;
    }

    public void setRealMoney(double realMoney) {
        this.realMoney = realMoney;
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public double getRedPacketMoney() {
        return redPacketMoney;
    }

    public void setRedPacketMoney(double redPacketMoney) {
        this.redPacketMoney = redPacketMoney;
    }

    public String getInvoiceType() {
        return invoiceType;
    }

    public void setInvoiceType(String invoiceType) {
        this.invoiceType = invoiceType;
    }

    public String getInvoiceHead() {
        return invoiceHead;
    }

    public void setInvoiceHead(String invoiceHead) {
        this.invoiceHead = invoiceHead;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getServicePhone() {
        return servicePhone;
    }

    public void setServicePhone(String servicePhone) {
        this.servicePhone = servicePhone;
    }

    public String getIsPay() {
        return isPay;
    }

    public void setIsPay(String isPay) {
        this.isPay = isPay;
    }

    public ArrayList<Integer> getChoosePayTypeList() {
        return choosePayTypeList==null?new ArrayList<Integer>():choosePayTypeList;
    }

    public void setChoosePayTypeList(ArrayList<Integer> choosePayTypeList) {
        this.choosePayTypeList = choosePayTypeList;
    }

    /**
     * 此实体用来处理企业地址
     */
    public static class CompanyAddressBean{
        private String companyName;
        private String companyAddress;
        private String operatorName;
        private String operatorPhone;

        public String getCompanyName() {
            return companyName;
        }

        public void setCompanyName(String companyName) {
            this.companyName = companyName;
        }

        public String getCompanyAddress() {
            return companyAddress;
        }

        public void setCompanyAddress(String companyAddress) {
            this.companyAddress = companyAddress;
        }

        public String getOperatorName() {
            return operatorName;
        }

        public void setOperatorName(String operatorName) {
            this.operatorName = operatorName;
        }

        public String getOperatorPhone() {
            return operatorPhone;
        }

        public void setOperatorPhone(String operatorPhone) {
            this.operatorPhone = operatorPhone;
        }
    }

    /**
     * 个人地址详情
     */
    public static class PersonAddressBean{
        private String consigneePeople;
        private String consigneePhone;
        private String consigneeAddress;

        public String getConsigneePeople() {
            return consigneePeople;
        }

        public void setConsigneePeople(String consigneePeople) {
            this.consigneePeople = consigneePeople;
        }

        public String getConsigneePhone() {
            return consigneePhone;
        }

        public void setConsigneePhone(String consigneePhone) {
            this.consigneePhone = consigneePhone;
        }

        public String getConsigneeAddress() {
            return consigneeAddress;
        }

        public void setConsigneeAddress(String consigneeAddress) {
            this.consigneeAddress = consigneeAddress;
        }
    }

    public String getOrderStatusStr(){
        if (TextUtils.isEmpty(orderStatus))return "";
        String orderStatusSTr="";
        switch (orderStatus){
            case Order_Status_Need_Pay:
                orderStatusSTr="待付款";
                break;
            case Order_Status_Complete:
                orderStatusSTr="已完成";
                break;
            case Order_Status_Close:
                orderStatusSTr="已关闭";
                break;
        }
        return orderStatusSTr;
    }
}
